﻿<local:TWPage
    x:Class="metroCIS.Win8Application.Views.GradeOverview"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:metroCIS.Win8Application.Views"
    xmlns:vm="using:metroCIS.ViewModel"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <Page.DataContext>
        <vm:GradeOverViewViewModel />
    </Page.DataContext>
    <Page.Resources>
        <CollectionViewSource
            x:Name="groupedItemsViewSource"
            IsSourceGrouped="true"
            ItemsPath="Value">
        </CollectionViewSource>
    </Page.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <ListBox Name="lbSemester" ItemsSource="{Binding GradeSummary}" SelectedItem="{Binding SelectedSemester, Mode=TwoWay}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="10">
                        <TextBlock FontSize="20" FontWeight="Bold" Text="{Binding Semester}"  Margin="20"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <GridView SelectionMode="None" IsItemClickEnabled="False" ItemsSource="{Binding SelectedItem.Grades, ElementName=lbSemester}" Grid.Column="1" HorizontalContentAlignment="Center">
            <GridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapGrid  />
                </ItemsPanelTemplate>
            </GridView.ItemsPanel>
            <GridView.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="10,0,10,10" Width="450" Background="{StaticResource twGreen}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock FontWeight="Bold" Margin="6" Grid.Row="0" Text="{Binding LV}" />
                        <TextBlock Margin="6" Grid.Row="1" Text="{Binding CertificateGrade}" />
                        <TextBlock Margin="6" Grid.Row="2" Text="{Binding DateOfGrade, Converter={StaticResource StringConverter}, ConverterParameter='M'}"  />
                        <Image Grid.Column="1" Grid.RowSpan="3" Margin="8" VerticalAlignment="Center" HorizontalAlignment="Center" Width="48" Height="48" Source="{Binding CertificateGrade,Converter={StaticResource GradeToSmiley}}"/>
                    </Grid>
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
        
        <!--<StackPanel Orientation="Vertical" Grid.Column="3">
            <TextBlock Foreground="Black" FontSize="32" Text="Notenschnitt:" Style="{StaticResource PageHeaderTextStyle}" />
            <TextBlock Foreground="Black" FontSize="28" Text="3.2" Style="{StaticResource PageHeaderTextStyle}" />
        </StackPanel>-->
    </Grid>
</local:TWPage>